import { port } from "./config/setting.js"
import Koa from 'koa'
import {useController} from './controllers/index.js'
import { sync } from "./db/index.js"
// import bodyParser from "koa-bodyparser"

//创建实例
const app = new Koa()

//中间件
app.use(async (ctx,next)=>{
  await next()
})

// app.use(bodyParser())
// 引入自己封装的控制器注册模块和bodyparser
useController(app)

await sync()
//监听
app.listen(port)

console.log(`server is running at http://s1.aizhihong.cn:${port}`);